package mpYoga

import (
	yogaService "duoke/service/yoga"
	"duoke/utils/gconv"
	"duoke/utils/request"
	"duoke/utils/response"
	"github.com/gin-gonic/gin"
)

var YogaDate = new(yogaDateCtl)

type yogaDateCtl struct{}

func (ctl *yogaDateCtl) List(c *gin.Context) {
	req := request.JsonMap(c)
	id := gconv.Int(req["id"])
	if id == 0 {
		response.Error(c, "参数缺失【id】", nil)
		return
	}
	classType := gconv.Int(req["type"])
	if classType == 0 {
		response.Error(c, "参数缺失【type】", nil)
		return
	}
	list, err := yogaService.GroupClass.DateList(c, id, classType)
	if err != nil {
		response.Error(c, err.Error(), nil)
		return
	}
	response.Success(c, "success", list)
}
